package com.tony.server;

import javax.annotation.Resource;

import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

@Lazy(false)
@Service
public class BootStartServer implements InitializingBean {

	@Resource
	BasicDataSource mockDataSource;

	@Override
	public void afterPropertiesSet() throws Exception {
		initSql();
	}

	private void initSql() {
		/*try {
			Connection conn = mockDataSource.getConnection();
			Statement stmt = conn.createStatement();

			List<String> aa = IOUtils.readLines(getClass().getClassLoader().getResourceAsStream("sqlite.sql"));
			String s = StringUtils.join(aa, "\r\n");
			String[] sqls = s.split(";");

			for (int i = 0; i < sqls.length; i++) {
				try {
					String sql = sqls[i];
					System.out.println("初始化sql : " + sql);
					stmt.execute(sql);
				} catch (Exception e) {
					// TODO: handle exception
				}
			}
			stmt.close();
			conn.close();
		} catch (Exception e) {
			e.printStackTrace();
		}*/
		System.out.println("屏蔽sql");
	}

}